<template>
  <div class="ckeditor_warpper">
    <!-- <ClassicEditor :model-value="editorData" /> -->
    <ckeditor
      :editor="editor"
      :config="editorConfig"
      :model-value="editorData"
      @input="onChange"
    ></ckeditor>
  </div>
</template>
<script lang="ts">
import ClassicEditor from '@ckeditor/ckeditor5-build-classic';
import '@ckeditor/ckeditor5-build-classic/build/translations/zh-cn';
import { defineComponent } from 'vue';

export default defineComponent({
  components: {},
  props: { editorData: { type: String, default: '' } },
  emits: ['onChange'],
  setup(props, { emit }) {
    const onChange = (value) => {
      emit('onChange', value);
    };

    const editorConfig = {
      language: 'zh-cn', //语言

      // extraPlugins: [ImgUploadAdapter], //图片上传
    };
    return { editor: ClassicEditor, onChange, editorConfig };
  },
});
</script>
<style lang="less" scoped></style>
